package com.city.itis.service.impl;

import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Component;
import com.city.itis.dao.HobbyDao;
import com.city.itis.domain.Hobby;
import com.city.itis.service.HobbyService;

/**
 * 爱好业务层实现类
 * @author WY
 *
 */
@Component("hobbyService")
public class HobbyServiceImpl implements HobbyService 
{
	private HobbyDao hobbyDao;
	
	public HobbyDao getHobbyDao() 
	{
		return hobbyDao;
	}
	@Resource
	public void setHobbyDao(HobbyDao hobbyDao) 
	{
		this.hobbyDao = hobbyDao;
	}

	@Override
	public int add(Hobby hobby) 
	{
		return  hobbyDao.save(hobby);
	}

	@Override
	public int delete(Hobby hobby) 
	{
		return  hobbyDao.delete(hobby);
	}

	@Override
	public int deleteById(Integer id)
	{
		return  hobbyDao.deleteById(id);
	}

	@Override
	public int modify(Hobby hobby) 
	{
		return  hobbyDao.update(hobby);
	}

	@Override
	public Hobby getHobbyById(Integer id) 
	{
		return  hobbyDao.getHobbyById(id);
	}
	
	@Override
	public Hobby getHobbyByName(String name) {
		return this.hobbyDao.getHobbyByName(name);
	}


	@Override
	public List<Hobby> findAll() 
	{
		return  hobbyDao.findAll();
	}
	
}
